<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>列表</title>
		<link  rel="stylesheet"  href="../static/css/styles.css" />
		<link rel="stylesheet"  href="../static/css/font-awesome-4.7.0/css/font-awesome.min.css" />
		<script  src="../static/js/jquery.min.js" type="text/javascript"></script>
	</head>
	<body>
	 <script>
function delcfm(p) {
            var r = confirm("确认删除该信息？");
            if (r == true) {
                var id = p.parentNode.parentNode.children[1].innerHTML;
				var coursename = p.parentNode.parentNode.children[2].innerHTML;
                var xml = new XMLHttpRequest();
                xml.open("get","http://127.0.0.1:8080/dele/"+id+"/"+coursename,true);
				// xml.onreadystatechange = function () {
				//
				// };
				xml.send();
				// xml.send("callback=functionName");
                alert("删除成功");
                window.location.href='{{url_for('xuanlist')}}';
            } else
                alert("信息未删除");
        }
        </script>
		<div class="condition">
			<form action="{{ url_for('listse') }}" method="post" enctype="multipart/form-data">
			用户名：<input type="text" name="name">
			学号：<input type="text" name="id">
			课程名：<input type="text" name="cl">
			<button>
				<i class="fa fa-search" type="submit"></i>
				<input type="submit" value="查询">

			</button>
			</form>
			<button onclick="window.location.href='{{url_for('add')}}'">
				<i class="fa fa-plus"></i>
				新增
			</button>
		</div>
		<table class="tablelist">
			<thead>
				<tr>
					<th>姓名</th>
					<th>学号</th>
					<th>课程</th>
					<th>时间</th>
					<th>权重</th>
					<th>是否选上(0/1)</th>
					<th width="120px">操作</th>
				</tr>
			</thead>
			{% for v in stu_info %}
				<tr>
					<td>{{v[0]}}</td>
					<td>{{v[1]}}</td>
					<td>{{v[2]}}</td>
					<td>{{v[3]}}</td>
					<td>{{v[4]}}</td>
					<td>{{v[5]}}</td>
					<td>
						<button class="remove" id="dsad" onclick=delcfm(this)>
							<i class="fa fa-remove"></i>
							删除
						</button>
					</td>
				</tr>
			{% endfor %}
		</table>
		<table class="page">
			<td>
				<button>首页</button>
				<button>上一页</button>
				<button>下一页</button>
				<button>尾页</button>
				<input  type="text"  class="page-no"  name="pageNo" />
				<button>转</button>
			</td>
		</table>
	</body>
</html>
